package com.ruoyi.gift.controller;


import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.gift.domain.StaStreet;
import com.ruoyi.gift.service.StaStreetService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 按照所属街道统计记录；statistics_streetController
 *
 * @author luoShuang
 * @date 2025-11-04
 */
@RestController
@RequestMapping("/system/street")
public class StaStreetController extends BaseController
{
    @Autowired
    private StaStreetService staStreetService;

    /**
     * 查询按照所属街道统计记录；statistics_street列表
     */
    @PreAuthorize("@ss.hasPermi('system:street:list')")
    @GetMapping("/list")
    public TableDataInfo list(StaStreet staStreet)
    {
        startPage();
        List<StaStreet> list = staStreetService.selectStaStreetList(staStreet);
        return getDataTable(list);
    }

    /**
     * 导出按照所属街道统计记录；statistics_street列表
     */
    @PreAuthorize("@ss.hasPermi('system:street:export')")
    @Log(title = "按照所属街道统计记录；statistics_street", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, StaStreet staStreet)
    {
        List<StaStreet> list = staStreetService.selectStaStreetList(staStreet);
        ExcelUtil<StaStreet> util = new ExcelUtil<StaStreet>(StaStreet.class);
        util.exportExcel(response, list, "按照所属街道统计记录；statistics_street数据");
    }

    /**
     * 获取按照所属街道统计记录；statistics_street详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:street:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(staStreetService.selectStaStreetById(id));
    }

    /**
     * 新增按照所属街道统计记录；statistics_street
     */
    @PreAuthorize("@ss.hasPermi('system:street:add')")
    @Log(title = "按照所属街道统计记录；statistics_street", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StaStreet staStreet)
    {
        return toAjax(staStreetService.insertStaStreet(staStreet));
    }

    /**
     * 修改按照所属街道统计记录；statistics_street
     */
    @PreAuthorize("@ss.hasPermi('system:street:edit')")
    @Log(title = "按照所属街道统计记录；statistics_street", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StaStreet staStreet)
    {
        return toAjax(staStreetService.updateStaStreet(staStreet));
    }

    /**
     * 删除按照所属街道统计记录；statistics_street
     */
    @PreAuthorize("@ss.hasPermi('system:street:remove')")
    @Log(title = "按照所属街道统计记录；statistics_street", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(staStreetService.deleteStaStreetByIds(ids));
    }
}

